# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=pwndbg
pkgver=2022.01.05
pkgrel=2
pkgdesc='Makes debugging with GDB suck less'
url='https://github.com/pwndbg/pwndbg'
arch=('any')
license=('MIT')
depends=('gdb' 'python' 'python-capstone' 'python-unicorn' 'python-pycparser' 'python-psutil' 'python-ptrace'
         'python-pyelftools' 'python-six' 'python-future' 'python-pygments' 'which')
optdepends=('checksec: checksec command support'
            'ropper: ropper command support'
            'ropgadget: ropgadget command support'
            'radare2: radare2 command support')
source=(https://github.com/pwndbg/pwndbg/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('ebb61b402bb6cbaa516c2b1d885f231f6f591c2226d02d69cdd163f674ed41aba5505e3390b47e431f93a6e5de3867feb93c2be6da03a32c5f4c7a0ff074fa08')
b2sums=('a221fa3af2145a819bc780f3395a168a91371ce1218dc4acfee2ac3420a78c8550c98921dbb03f4bc928cdac07fdc6bed8be7c642a5be42064492192b3443ea6')

prepare() {
  cd ${pkgname}-${pkgver}
  sed '/0L/d' -i ida_script.py
}

build() {
  cd ${pkgname}-${pkgver}
  python -m compileall .
  python -O -m compileall .
}

package() {
  cd ${pkgname}-${pkgver}
  install -d "${pkgdir}/usr/share/pwndbg"
  cp -r *.py pwndbg __pycache__ "${pkgdir}/usr/share/pwndbg"
  install -Dm 644 README.md FEATURES.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE.md -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
